use std::rc::Rc;
use crate::common::Digital;
use crate::Digital1Line;
use crate::output::{DigitalState, State};
#[allow(unused)]
///The InitSig structure provides the initial input level signal source for the circuit.
#[derive(Debug, Clone)]
pub struct InitSig {
    output_state: DigitalState,
    times: usize,
}
impl Digital1Line for InitSig{}
impl Digital for InitSig {
    fn get_output(&self) -> DigitalState {
        self.output_state.clone()
    }
}
impl InitSig {
    pub fn new(output_state: Vec<Option<State>>) -> Rc<Self> {
        let times = output_state.len();
        let output_state = DigitalState::new(vec![output_state.clone()], 1, times);
        Rc::new(Self {
            output_state,
            times,
        })
    }

    pub fn output_state(&self) -> DigitalState {
        self.output_state.clone()
    }

    pub fn times(&self) -> usize {
        self.times
    }
}
